package org.flexlancer.databases
{
	import org.flexlancer.utils.DateTimeUtils;
	
	public class DemandSheet
	{
		public static const TABLE:String = "demandsheet";

		public static function Add(entrydate:String,
									title:String,
									catname:String,
									openingbalance:Number,
									demand:Number,
									issue:Number,
									total:Number,
									used:Number,
									closingbalance:Number):void{
			try{
				var insertObj:Object = new Object();
				
				insertObj.entrydate = entrydate;
				insertObj.title = title;
				insertObj.catname = catname;
				insertObj.openingbalance = openingbalance;
				insertObj.demand = demand;
				insertObj.issue = issue;
				insertObj.total = total;
				insertObj.used = used;
				insertObj.closingbalance = closingbalance;
				
				DatabaseManager.Manager.Insert(TABLE,insertObj);
			}catch(err:Error){
				throw err;
			}
		}

		public static function List(condition:String = ""):Array{
			try{
				return DatabaseManager.Manager.Select(TABLE,null,condition);
			}catch(err:Error){
				throw err;
			}
			return new Array;
		}

		public static function Delete(condition:String = ""):void{
			try{
				DatabaseManager.Manager.Delete(TABLE,condition);
			}catch(err:Error){
				throw err;
			}
		}

	}
}